import 'package:base_flutter/base_flutter.dart';
import 'package:base_package_init/net/common_apis.dart';
import 'package:flutter/cupertino.dart';

import '../net/response/code_value_entity.dart';

var urlencodedHeader = Options(contentType: Headers.formUrlEncodedContentType);

class ComboDataModel extends BaseMvvmModel{
  @override
  void onCleared() {
  }

  ///请假原因
  static const String leaveReason = "29";
  ///与长者关系
  static const String relationShip = "5";
  ///病因类型id
  static const String diseaseReason = "83";
  ///就医形式
  static const String medicalWay = "81";
  ///就医时间
  static const String medicalTimeType = "84";
  ///就医计划
  static const String medicalPlan = "82";
  ///维修类型
  static const String repairType = "10024";
  ///餐别
  static const String foodTime = "11200";
  ///是否显示点餐金额
  static const String showPrice = "38391";

  Future<List<CodeValue>> getComboData(String codeTypeId) async {
    var map = {"codeTypeId": codeTypeId};
    var result = await HttpGo.instance
        .postData(CommonApis.comboData, data: map, options: urlencodedHeader);
    if("0"==result['code']){
     return (( result['data']['rows'] as List?)??[]).map((e) => CodeValue.fromJson(e)).toList();
    }else{
      throw result['msg'];
    }
  }

}